import { defineConfig } from '@umijs/max'
import routes from './router.js'
import config from './defaultConfig.js'

export default defineConfig({
  antd: {},
  access: {},
  model: {},
  initialState: {},
  request: {},
  dva: {},
  mfsu: {},
  routes,
  clickToComponent: {},
  title: '管理后台',
  favicons: ['https://qny.weizulin.cn/images/favicon75.ico'],
  manifest: { basePath: '/' },
  base: '/',
  publicPath: '/',
  proxy: { '/api': { target: config.baseUrl, changeOrigin: true } },
  npmClient: 'pnpm',
  define: {
    'process.env': {
      NODE_ENV: process.env.NODE_ENV,
      BASE_URL: config.baseUrl,
      PLATFORM_NAME: '尖米粒',
      LOGO: 'https://qny.weizulin.cn/images/logo75.png',

      //  线上
      SUB_URL: ['https://adminajml.smallrice.com.cn', 'https://adminbjml.smallrice.com.cn'],
      PLATFORM_URL: ['https://adminjml.smallrice.com.cn', 'https://storejml.smallrice.com.cn'],
      ADMIN_PREFIX: 'admin',
      STORE_PREFIX: 'store'
    }
  },
  outputPath: 'dist',
  // 清除缓存机制
  metas: [
    {
      httpEquiv: 'Cache-Control',
      content: 'no-cache'
    },
    {
      httpEquiv: 'Pragma',
      content: 'no-cache'
    },
    {
      httpEquiv: 'Expires',
      content: '0'
    }
  ],
  hash: true // 打包文件加hash
})
